#include <iostream>
#include <sys/eventfd.h>
#include <cstdint>
#include <unistd.h>
int main(int argc, char const *argv[])
{
    int efd = eventfd(0,EFD_CLOEXEC|EFD_NONBLOCK);
    if(efd < 0) {
        perror("eventfd create err");
        return -1;
    }    
    uint64_t val = 1;
    write(efd,&val,sizeof(uint64_t));
    write(efd,&val,sizeof(uint64_t));
    write(efd,&val,sizeof(uint64_t));
    write(efd,&val,sizeof(uint64_t));
    uint64_t res = 0;
    read(efd,&res,sizeof(res));
    std::cout << res << std::endl;
    close(efd);
    return 0;
}

